package net.m510.autosurfer.sonybank;

import java.io.File;
import java.net.URI;
import java.util.List;
import java.util.logging.Logger;

import net.m510.autosurfer.common.FilePostProcess;
import net.m510.autosurfer.core.Parameters;
import net.m510.autosurfer.core.utils.AnalyzeUtils;

import org.apache.http.NameValuePair;
import org.apache.http.client.protocol.HttpClientContext;
import org.apache.http.impl.client.CloseableHttpClient;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.FormElement;

public class SonyBankDownload extends FilePostProcess {
	private static final Logger log = Logger.getLogger(SonyBankDownload.class.getName());

	public SonyBankDownload() {
		this(null,null,null);
	}
	
	public SonyBankDownload(CloseableHttpClient client,HttpClientContext context, File file) {
		super(client, context,file);
		super.log = log;
	}

	@Override
	protected URI getUri(Document doc) {
		return AnalyzeUtils.resolveURIByPath(context, "/TDGate000036/gate/NBW000036/YenFutsuRireki.csv");
	}

	@Override
	protected List<NameValuePair> getRequestParameters(Document doc) {
		FormElement form = AnalyzeUtils.getFormElementByName(doc, "DOWNLOAD");
		Parameters p = Parameters.create(form);
		return p.asNameValueList();
	}
}
